<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="zh-CN">
<head>
<%@ include file="/include/include.jsp" %>

	<script type="text/javascript">
		var ctx_ = "<%=request.getContextPath()%>";
		function chooseRegion(form,id){
	
			if (id == "") {
				return;
			}
			var url =  ctx_ + '/warehouse/stock/region/' + id + '/view' ;
			form.action=url;
			form.submit();
		}

		function chooseWarehouse(form,id){
			if (id == ""){
				return ;
			}

			form.submit();
			
		}
	</script>
</head>

	<body>
		<%@ include file="/include/header.jsp" %>
		<%@ include file="/include/script.jsp" %>
		<%@ include file="/include/menu.jsp" %>
		<div id="mainContent">
		
			<h2><a href="${ctx}/${menu.url}">${menu.description}</a>&nbsp;-&nbsp;<a href="${ctx}/${empty currViewBarSubMenu_ ? submenu.url : currViewBarSubMenu_.url}">${empty currViewBarSubMenu_ ? submenu.description : currViewBarSubMenu_.description}</a></h2>
			
			<div class="tool-bar">
				<div title="${menu.description} - ${empty currViewBarSubMenu_ ? submenu.description : currViewBarSubMenu_.description} - 查询${empty currViewBarSubMenu_ ? submenu.description : currViewBarSubMenu_.description}"  href="${ctx}/warehouse/stock/search/filter" class="modal-window modal-link">过滤查询</div>
				<a href="${ctx }/modify/stock/export">导出实时库存报表</a>
			</div>
		</div>
			
			<form id="form1" action="${ctx}/warehouse/stock/search/do" method="post"  style="margin: 0px;" onSubmit="return Validator.Validate(this,3)">
				<table cellspacing="0" cellpadding="0" align="left">
					<tbody>
						<tr>
							<td width="60px">地区选择：</td>
							<td>
								<select name="myregion" dataType="Require" msg="未选定仓储" onchange="chooseRegion($('form1'),this.value);">
									<option value="" >请选择</option>
									<c:forEach var="region_" items="${regions}" varStatus="status">
											<option value="${region_.id}"  ${region_.id == region.id ? 'selected="selected"' : '' }>${region_.number} - ${region_.name }</option>
									</c:forEach>
								</select>
							</td>
							<td width="60px">仓储选择：</td>
							<td colspan="3">
								<select name="eq.inventory.warehouse.code" dataType="Require" msg="未选定仓储" onchange="$('form1').submit();">
									<option value="" selected="selected" >请选择</option>
									<c:forEach var="warehouse" items="${warehouses}" varStatus="status">
											<option value="${warehouse.code}"  >${warehouse.code} - ${warehouse.name }</option>
									</c:forEach>
								</select>
							</td>
						</tr>
					</tbody>
				</table>
				
				<br />
				<br />
			
				<table class="grid" cellspacing="0">
					<thead>
						<tr>
							<td>仓储编号</td>
							<td>仓储名称</td>
							<td>所在区域</td>
							<td>联系人</td>
							<td>联系地址 </td>
						</tr>
					</thead>
					<tbody>
						<c:forEach var="warehouse" items="${warehouses}" varStatus="status">
							
							<tr onmouseover="this.style.backgroundColor= '#A0CFEC'" onmouseout="this.style.backgroundColor= '#ffffff'" ${ inventory.inventoryWarningRecord != null ? 'class="warning" ' : ''}>
								<td>
									<a href="${ctx}/warehouse/stock/waresearch/${warehouse.id}/view">${warehouse.code}</a>	
								</td>
								<td>
									<a href="${ctx}/warehouse/stock/waresearch/${warehouse.id}/view">${warehouse.name}</a>	
								</td>
								<td>${warehouse.region.name}</td>
								<td>${warehouse.person}</td>
								<td>${warehouse.address}</td>
						</tr>
						</c:forEach>
					</tbody>
				</table>
			</form>
		</div>
	</body>	
</html>
